﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MaymuseMS.Models.ValueObject;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace MaymuseMS.Models {
    public class InDepository {
        public int InDepositoryId { get; set; }

        public virtual ProductValueObject ProductValueObject { get; set; }

        public DateTime Date { get; set; }
        public double Count { get; set; }
        //批号
        [Required]
        [MaxLength(100)]
        public string Number { get; set; }
        [MaxLength(300)]
        public string Location { get; set; }
        public int? OrderItemId { get; set; }
        public virtual OrderItem OrderItem { get; set; }
        [MaxLength(1000)]
        public string Remark { get; set; }

        public string SupplierNumber {
            get {
                if (OrderItem != null) {
                    return OrderItem.Order.Supplier.Number ;
                }
                return "";
            }
        }
        public string SupplierName {
            get {
                if (OrderItem != null) {
                    return OrderItem.Order.Supplier.Name;
                }
                return "";
            }
        }
        public string OrderNumber {
            get {
                if (OrderItem != null) {
                    return OrderItem.Order.Number;
                }
                return "";
            }
        }
    }
}